home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!bounce-back
- Date: 10 Jan 96 08:21:21 GMT
- Approved: fjh@cs.mu.oz.au
- Organization: -
- Newsgroups: comp.std.c++
- X-Original-Date: Tue, 9 Jan 1996 22:22:27 GMT
- Message-ID: <199601092222.WAA27727@eiger.pncl.co.uk>
- X-Sender: dcb@pncl.co.uk
- X-Mailer: Windows Eudora Version 1.4.4
- Content-Type: text/plain; charset="us-ascii"
- From: dcb@pncl.co.uk (David C Binderman)
- Subject: ambiguous or not ?
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBEAgUBMPN3JeEDnX0m9pzZAQE4tQF46EPX7yH0MqYEuO7DLitQjh/sShWjyLBg
- xdQ2aeI5rSHO2JTzOyvBRu3zmoJfF9w=
- =/0ch
-
- Hello there,
-
- Following on from an outbreak of compiler disagreement,
-
- // is this ambiguous or not ?
-
- // workaround is to use cast on lhs
-
-
-
- #include <iostream.h>
-
-
- class S
- {
-
- public:
-
- S( char ) {
-
- cerr << "S::S char\n";
-
- };
-
- S( unsigned char ) {
-
- cerr << "S::S char\n";
-
- };
- };
-
-
-
- operator == ( char, const S &)
-
- {
-
- cerr << "operator ==\n";
-
- };
-
-
-
- class R
- {
-
- public:
-
- enum { a, b, c};
-
- operator int () {
-
- cerr << "R::operator int\n";
-
- };
-
- };
-
-
-
- int
- main()
-
- {
-
- R z;
-
- // if ((int) z == R::a)
- // workaround line
- if (z == R::a)
- // ambiguous ?
- ;
-
- }
-
- my opinion is that the code is ok, and the compilers that think it is
- ambiguous are wrong.
-
- Your opinion sought
-
- Regards
- David Binderman MSc BSc +44 1293 544 364 dcb@pncl.co.uk
- If only everything in life was as reliable as a Toyota
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-